var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var EventProxy = require('eventproxy');

var UserSchema = new Schema({
	loginName: String,
	password: String,
	email: String,
	description: String,
	avatar: { type: String, default: '' },
	lastLoginAt: Date,
	createAt: { type: Date, default: new Date() }
});

UserSchema.virtual('avatarUrl').get(function () {
	return this.avatar || '/img/avatar.jpg';
});

mongoose.model('User', UserSchema);